package com.tjp.oss.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: jz-club
 * @description: minio配置管理
 * @author: aaronTang
 * @create: 2024-03-06
 */
@Configuration
public class MinioConfig {

    @Value("${minio.url}")
    private String url;

    @Value("${minio.accessKey}")
    private String accessKey;

    @Value("${minio.secretKey}")
    private String secretKey;

    /**
     * 构造minio 通过bean的方式返回回去
     * @return
     */
    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder().endpoint(this.url).credentials(this.accessKey, this.secretKey).build();
    }
}
